﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>Scheme Handler Test</title>

    <script type="text/javascript">
        var htmlNode;
        var newLine = "\n";
        var showError = function (text)
        {
            if (!htmlNode)
            {
                htmlNode = document.createElement("div");
                htmlNode.id = "debugWindow";
                document.body.appendChild(htmlNode);
            }

            htmlNode.innerHTML += "<p>" + text + "</p>";
        };

        var doRequest = function ()
        {
            var data = new FormData();
            data.append('name', 'test');
            data.append('value', 'anotherValue');
            var x = new XMLHttpRequest();
            x.open("POST", "PostDataAjaxTest.html", true);
            //Send the proper header information along with the request
            x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

            x.onload = function ()
            {
                showError(x.responseText);
            };

            x.onerror = function (e)
            {
                showError(e);
            };

            x.send(data);
        };
    </script>
</head>
<body>
    <h1>Success</h1>
    <p>Scheme Handler Functioned Correctly</p>

    <form action="custom://cefsharp/PostDataTest.html" method="post" target="_blank">
        User:<input type="text" name="user" value="lion" />
        <br>
        Pass:<input type="text" name="pass" value="123" />
        <br>
        <input type="submit" value="Test POST Data" />
    </form>

    <h1>Custom Post using Ajax</h1>
    <button onclick="doRequest(); return false;">Submit via ajax</button>
</body>
</html>